<form id="form_salesorder_showedit" method="post" action="y.php?r=salesorder/savedata">
    <input type="hidden" name="salesorder_id" value="">
    <input type="hidden" name="customer_id">
    <input type="hidden" name="contacter_id">
    <table class="tab_form">
        <tr>
            <td><input class="easyui-textbox" name="salesorder_number"  data-options="label:'合同订单:',required:true"></td>
            <td><select class="easyui-combobox" name="stage"
                        data-options="label:'状态:',required:true,url:'y.php?r=middle/picklist/getdata&picklistkey=stage&picklistvalue=<?php echo $salesorder['stage']; ?>',valueField:'id',textField:'text'">
                </select></td>
            <td>
                <input class="easyui-textbox" id="form_salesorder_showedit_customer_name"  data-options="label:'客户:',required:true,value:'<?php echo $salesorder['customer_name']; ?>'" />
                <a href="#" class="easyui-linkbutton fr" data-options="iconCls:'icon-search'" onclick="loadWin2('选择客户','y.php?r=customer/select&form=form_salesorder_showedit')" >选择</a>
            </td>
        </tr>
        <tr>
            <td>
                <input class="easyui-textbox" id="form_salesorder_showedit_contacter_name"  data-options="label:'联系人:',required:true,value:'<?php echo $salesorder['contacter_name']; ?>'" />
                <a href="#" class="easyui-linkbutton fr" data-options="iconCls:'icon-search'" onclick="loadWin2('选择联系人','y.php?r=contacter/select&form=form_salesorder_showedit')" >选择</a>
            </td>
            <td><input class="easyui-datetimebox" name="signdate"  data-options="label:'签约日期:',required:true"></td>
            <td><select class="easyui-combobox" name="gather_status"
                data-options="label:'状态:',required:true,url:'y.php?r=middle/picklist/getdata&picklistkey=gather_status&picklistvalue=<?php echo $salesorder['gather_status']; ?>',valueField:'id',textField:'text'">
                </select></td>
        </tr>
    </table>
</form>
<div style="text-align:center;padding:5px 0">
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">保存</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">清空</a>
</div>
<script>
    var dataobj = <?php echo json_encode($salesorder) ?>;
    $(function () {
        $('#form_salesorder_showedit').form('load',dataobj);
    });
    function submitForm() {
        $('#form_salesorder_showedit').form('submit',{
            success: function(){
                $('#win_main').window("close");
                $("#salesorder_list").datagrid("reload");
            }
        });
    }
    function clearForm() {
        $('#form_salesorder_showedit').form('clear');
        if(dataobj!=null){
            $("input[name=salesorder_id]").val(dataobj.salesorder_id);
        }
    }
</script>